home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / network / info-sys / www / tkhtml-2.3 / tkhtml-2 / tkHTML-2.3 / menus.tcl < prev    next >
Encoding:
Text File  |  1995-02-26  |  18.9 KB  |  597 lines

  1. ##################
  2. # Build menus
  3.  
  4. #############################################
  5. # Menu trees
  6.  
  7. proc MkMainMenu {} {
  8.     frame .menuframe -relief raised -bd 2
  9.     pack .menuframe -side top -fill both
  10.     menubutton .menuframe.file -text "File" -underline 0 \
  11.         -menu .menuframe.file.m
  12.     menubutton .menuframe.edit -text "Edit" -underline 0 \
  13.         -menu .menuframe.edit.m
  14.     menubutton .menuframe.font -text "Font" -underline 3 \
  15.         -menu .menuframe.font.m
  16.     menubutton .menuframe.func -text "Functions" -underline 2 \
  17.         -menu .menuframe.func.m
  18.     menubutton .menuframe.forms -text "Forms" -underline 2 \
  19.         -menu .menuframe.forms.m
  20.     menubutton .menuframe.anchors -text "Anchors" -underline 0 \
  21.         -menu .menuframe.anchors.m
  22.     menubutton .menuframe.entities -text "Entities" -underline 0 \
  23.         -menu .menuframe.entities.m
  24.     
  25.     menubutton .menuframe.help -text "Help" -underline 0 \
  26.         -menu .menuframe.help.m
  27.  
  28.     MkMainMenuFile
  29.     MkMainMenuEdit
  30.     MkMainMenuFont
  31.     MkMainMenuFunctions
  32.     MkMainMenuForms
  33.     MkMainMenuAnchors
  34.     MkMainMenuEntities
  35.     MkMainMenuHelp
  36.  
  37.  
  38.     pack .menuframe.file .menuframe.edit .menuframe.font \
  39.         .menuframe.func .menuframe.forms .menuframe.anchors .menuframe.entities\
  40.         -side left -padx 3
  41.     pack .menuframe.help -side right -padx 3
  42.  
  43.         tk_menuBar .menuframe .menuframe.file .menuframe.edit \
  44.         .menuframe.font .menuframe.func .menuframe.forms .menuframe.anchors\
  45.         .menuframe.entities .menuframe.help
  46. }
  47.  
  48. proc MkMainMenuFile {} {
  49.     menu .menuframe.file.m
  50.     .menuframe.file.m add command -label "New" -underline 0 \
  51.         -command {NewFileDlg}
  52.     .menuframe.file.m add command -label "Open" -underline 0 \
  53.         -command {OpenFileDlg}
  54.     .menuframe.file.m add command -label "Save" -underline 0 \
  55.         -command {SaveFileDlg SaveCmd} -accelerator "  Ctrl-s"
  56.     .menuframe.file.m add command -label "Save as" -underline 3 \
  57.         -command {SaveFileAs}
  58.     .menuframe.file.m add separator
  59.     .menuframe.file.m add command -label "About" -underline 1 \
  60.         -command {AboutDlg}
  61.     .menuframe.file.m add command -label "Quit" -underline 1 \
  62.         -command {QuitDlg} -accelerator "  Ctrl-q"
  63. }
  64.  
  65. proc MkMainMenuEdit {} {
  66.     menu .menuframe.edit.m
  67.     .menuframe.edit.m add command -label "Cut" -underline 0 \
  68.         -command {
  69.             global CUTBUFFER
  70.             set CUTBUFFER [selection get]
  71.             .textframe.vp.text delete sel.first sel.last
  72.         } -accelerator "  Ctrl-X"
  73.     .menuframe.edit.m add command -label "Copy" -underline 1 \
  74.         -command {
  75.             global CUTBUFFER
  76.             set CUTBUFFER [selection get]
  77.         } -accelerator "  Ctrl-C"
  78.     .menuframe.edit.m add command -label "Paste" -underline 0 \
  79.         -command {
  80.             global CUTBUFFER
  81.             .textframe.vp.text insert insert $CUTBUFFER
  82.         } -accelerator "  Ctrl-V"
  83.     .menuframe.edit.m add separator
  84.     .menuframe.edit.m add command -label "Find ..." -underline 0 \
  85.         -command {
  86.             SearchDlg
  87.         } -accelerator "  Ctrl-S"
  88.     .menuframe.edit.m add command -label "Find again" -underline 5 \
  89.         -command {
  90.             Search
  91.         } -accelerator "  Ctrl-F"
  92.     .menuframe.edit.m add command -label "Replace" -underline 0 \
  93.         -command {
  94.             SearchReplaceDlg
  95.         } -accelerator "  Ctrl-R"
  96. }
  97.  
  98. proc MkMainMenuFont {} {
  99.     global netscape 
  100.  
  101.     menu .menuframe.font.m
  102.     .menuframe.font.m add command -label "Bold <B>" \
  103.         -underline 0 -command {DoFormat <B> </B>} -accelerator "  Alt-b"
  104.     .menuframe.font.m add command \
  105.         -label "Italic <I>" \
  106.         -underline 0 -command {DoFormat <I> </I>} -accelerator "  Alt-i"
  107.     .menuframe.font.m add command -label "Underline <U>" \
  108.         -underline 0 -command {DoFormat <U> </U>} \
  109.         -accelerator "  Alt-u"
  110.     .menuframe.font.m add separator
  111.     if {$netscape == 1} {
  112.         .menuframe.font.m add command \
  113.             -label "Center  <CENTER>" \
  114.             -accelerator "  Alt-C" \
  115.             -command {DoFormat <CENTER>\n </CENTER>\n}
  116.         .menuframe.font.m add cascade -label "Font <FONT>"\
  117.              -underline 0 \
  118.             -menu .menuframe.font.m.size 
  119.         MkMainMenuFontSize
  120.     }
  121.     .menuframe.font.m add command -label "Typewriter <TT>" \
  122.         -underline 0 -command {DoFormat <TT>  </TT>}
  123.     .menuframe.font.m add command -label "Citation <CITE>" \
  124.         -underline 0 -command {DoFormat <CITE> </CITE>} 
  125.     .menuframe.font.m add command -label "Code <CODE>" \
  126.         -underline 3 -command {DoFormat <CODE> </CODE>} \
  127.         -accelerator "  Alt-c"
  128.     .menuframe.font.m add command -label "Emphasis <EM>" \
  129.         -underline 0 -command {DoFormat <EM> </EM>} \
  130.         -accelerator "  Alt-e"
  131.     .menuframe.font.m add command -label "Strong <STRONG>" \
  132.         -underline 0 -command {DoFormat <STRONG> </STRONG>} \
  133.         -accelerator "  Alt-s"
  134.     .menuframe.font.m add command -label "Sample <SAMP>" \
  135.         -underline 1 -command {DoFormat <SAMP> </SAMP>}
  136.     .menuframe.font.m add command -label "Keyboard <KBD>" \
  137.         -underline 0 -command {DoFormat <KBD> </KBD>}
  138.     .menuframe.font.m add command -label "Variable <VAR>" \
  139.         -underline 0 -command {DoFormat <VAR> </VAR>}
  140.     .menuframe.font.m add command -label "Definition <DFN>" \
  141.         -underline 0 -command {DoFormat <DFN> </DFN>} 
  142.     .menuframe.font.m add command -label "Address <ADDRESS>" \
  143.         -underline 0 -command {DoFormat <ADDRESS> </ADDRESS>} \
  144.         -accelerator "  Alt-a"
  145.     if {$netscape == 1} {
  146.         .menuframe.font.m add command \
  147.             -label "Blink  <BLINK>" \
  148.             -accelerator "  Alt-B" \
  149.             -command {DoFormat <BLINK> </BLINK>}
  150.     }    
  151. }
  152.  
  153. proc MkMainMenuFontSize {} {
  154.     menu .menuframe.font.m.size
  155.     for {set i 1} {$i < 8} {incr i +1} {
  156.         set foo "DoFormat \{<FONT SIZE=$i>\} <FONT>"
  157.         .menuframe.font.m.size add command \
  158.         -label " $i " \
  159.         -command $foo
  160.     }
  161. }
  162.     
  163.  
  164.  
  165. proc MkMainMenuFunctions {} {
  166.     global netscape
  167.     menu .menuframe.func.m
  168.     .menuframe.func.m add cascade -label "Headers" -underline 0 \
  169.         -menu .menuframe.func.m.headers 
  170.     MkMainMenuFuncHeaders
  171.  
  172.     .menuframe.func.m add cascade -label "Lists" -underline 0 \
  173.         -menu .menuframe.func.m.lists
  174.     MkMainMenuFuncLists
  175.  
  176.     .menuframe.func.m add separator
  177.     .menuframe.func.m add command \
  178.         -label "Title <TITLE>" \
  179.         -command {DoFormat <TITLE> </TITLE>} \
  180.         -accelerator "  Alt-t"
  181.     if {$netscape != 1} {
  182.         .menuframe.func.m add command \
  183.             -label "Horizontal line <HR>" \
  184.             -command {
  185.                 .textframe.vp.text insert insert "<HR>\n"
  186.             } -accelerator "  Alt-h"
  187.     } else {
  188.         .menuframe.func.m add cascade \
  189.             -label "Horiz Rule <HR>" -underline 0 \
  190.             -accelerator "  Alt-h" \
  191.             -menu .menuframe.func.m.hr
  192.         MkMainMenuFuncHR
  193.     }
  194.     .menuframe.func.m add command \
  195.         -label "Preformatted <PRE>" -underline 0 \
  196.         -command {DoFormat <PRE> </PRE>} -accelerator "  Alt-P"
  197.     .menuframe.func.m add command \
  198.         -label "List item <LI>" \
  199.         -command {
  200.             .textframe.vp.text insert insert "<LI>"
  201.         } -accelerator "  Alt-l"
  202.     .menuframe.func.m add command \
  203.         -label "Paragraph <P>" \
  204.         -command {
  205.             .textframe.vp.text insert insert "<P>"
  206.         } -accelerator "  Alt-Enter"
  207.     if {$netscape == 1} {
  208.     .menuframe.func.m add command \
  209.         -label "Wordbreak <WBR>" \
  210.         -command {
  211.             .textframe.vp.text insert insert "<WBR>"
  212.         } 
  213.     .menuframe.func.m add command \
  214.         -label "No break <NOBR>" \
  215.         -command {
  216.             .textframe.vp.text insert insert "<NOBR>"
  217.         } 
  218.     }
  219.     .menuframe.func.m add command -label "Comment <!-- ..>" \
  220.         -command {DoFormat "<!--" ">"}
  221. }
  222.  
  223. proc MkMainMenuFuncHeaders {} {
  224.     menu .menuframe.func.m.headers
  225.     .menuframe.func.m.headers add command \
  226.         -label "Header 1" \
  227.         -command {DoFormat <H1> </H1>} \
  228.         -accelerator "  Alt-1"
  229.     .menuframe.func.m.headers add command \
  230.         -label "Header 2" \
  231.         -command {DoFormat <H2> </H2>} \
  232.         -accelerator "  Alt-2"
  233.     .menuframe.func.m.headers add command \
  234.         -label "Header 3" \
  235.         -command {DoFormat <H3> </H3>} \
  236.         -accelerator "  Alt-3"
  237.     .menuframe.func.m.headers add command \
  238.         -label "Header 4" \
  239.         -command {DoFormat <H4> </H4>} \
  240.         -accelerator "  Alt-5"
  241.     .menuframe.func.m.headers add command \
  242.         -label "Header 5" \
  243.         -command {DoFormat <H5> </H5>} \
  244.         -accelerator "  Alt-5"
  245.     .menuframe.func.m.headers add command \
  246.         -label "Header 6" \
  247.         -command {DoFormat <H6> </H6>} \
  248.         -accelerator "  Alt-6"
  249. }
  250.  
  251. proc MkMainMenuFuncHR {} {
  252.     menu .menuframe.func.m.hr
  253.     .menuframe.func.m.hr add command \
  254.         -label "Default <HR>" \
  255.         -accelerator "  Alt-h" \
  256.         -command {
  257.             .textframe.vp.text insert insert "<HR>\n" \
  258.         } 
  259.     .menuframe.func.m.hr add command \
  260.         -label "NOSHADE" \
  261.         -command {
  262.             .textframe.vp.text insert insert "<HR NOSHADE>\n"
  263.         }
  264.     .menuframe.func.m.hr add command \
  265.         -label "SIZE" \
  266.         -command {DoFormat "<HR SIZE=" >\n}
  267.     .menuframe.func.m.hr add command \
  268.         -label "WIDTH" \
  269.         -command {DoFormat "<HR WIDTH=" >\n}
  270.     .menuframe.func.m.hr add cascade\
  271.         -label "ALIGN" \
  272.         -menu .menuframe.func.m.hr.align
  273.         MkMainMenuFuncHRAlign
  274.     .menuframe.func.m.hr add command \
  275.         -label "All options" \
  276.         -command {
  277.             .textframe.vp.text insert insert "<HR SIZE= WIDTH= ALIGN= >\n"
  278.         }
  279. }
  280.  
  281. proc MkMainMenuFuncHRAlign {} {
  282.     menu .menuframe.func.m.hr.align
  283.     .menuframe.func.m.hr.align add command \
  284.         -label " middle" \
  285.         -command {
  286.             .textframe.vp.text insert insert "<HR ALIGN=middle>\n"
  287.         }
  288.     .menuframe.func.m.hr.align add command \
  289.         -label " left" \
  290.         -command {
  291.             .textframe.vp.text insert insert "<HR ALIGN=left>\n"
  292.         }
  293.     .menuframe.func.m.hr.align add command \
  294.         -label " right" \
  295.         -command {
  296.             .textframe.vp.text insert insert "<HR ALIGN=right>\n"
  297.         }
  298. }
  299.  
  300.  
  301. proc MkMainMenuFuncLists {} {    
  302.     global netscape
  303.     menu .menuframe.func.m.lists
  304.     .menuframe.func.m.lists add command -label "Definition list <DL>" \
  305.         -command {DoFormat <DL>\n </DL>\n}
  306.     if {$netscape == 1} {
  307.         .menuframe.func.m.lists add cascade \
  308.             -label "Ordered List <OL>" \
  309.             -menu .menuframe.func.m.lists.oltype
  310.         MkMainMenuFuncListsOLType
  311.     } else {
  312.         .menuframe.func.m.lists add command \
  313.             -label "Ordered List <OL>" \
  314.             -command {DoFormat <OL>\n </OL>\n}
  315.     }
  316.     .menuframe.func.m.lists add command \
  317.         -label "Directory list <DIR>" \
  318.         -command {DoFormat <DIR>\n </DIR>\n}
  319.     if {$netscape == 1} {
  320.         .menuframe.func.m.lists add cascade \
  321.             -label "Unordered List <UL>" \
  322.             -menu .menuframe.func.m.lists.ultype
  323.         MkMainMenuFuncListsULType
  324.     } else {
  325.         .menuframe.func.m.lists add command \
  326.             -label "Unordered List <UL>" \
  327.             -command {DoFormat <UL>\n </UL>\n}
  328.     }
  329.     .menuframe.func.m.lists add separator
  330.     .menuframe.func.m.lists add command -label "List item <LI>"\
  331.         -command {.textframe.vp.text insert insert "<LI>"} \
  332.         -accelerator "  Alt-l"
  333.     .menuframe.func.m.lists add command -label "List item <DT>"\
  334.                 -command {.textframe.vp.text insert insert "<LI>"}
  335.         .menuframe.func.m.lists add command -label "List item <DD>"\
  336.                 -command {.textframe.vp.text insert insert "<LI>"} 
  337. }
  338.  
  339. proc MkMainMenuFuncListsOLType {} {
  340.         menu .menuframe.func.m.lists.oltype
  341.     .menuframe.func.m.lists.oltype add command \
  342.         -label "Default <OL>" \
  343.         -command {DoFormat <OL>\n </OL>\n}
  344.         .menuframe.func.m.lists.oltype add command \
  345.                 -label "Capital letters" \
  346.                 -command {DoFormat "<OL TYPE=A>\n" </OL>\n"}
  347.         .menuframe.func.m.lists.oltype add command \
  348.                 -label "Small letters" \
  349.                 -command {DoFormat "<OL TYPE=s>\n" </OL>\n"}
  350.         .menuframe.func.m.lists.oltype add command \
  351.                 -label "Large Roman numerals" \
  352.                 -command {DoFormat "<OL TYPE=I>\n" </OL>\n"}
  353.         .menuframe.func.m.lists.oltype add command \
  354.                 -label "Small Roman numerals" \
  355.                 -command {DoFormat "<OL TYPE=i>\n" </OL>\n"}
  356.         .menuframe.func.m.lists.oltype add command \
  357.                 -label "Default numbers" \
  358.                 -command {DoFormat "<OL TYPE=1>\n" </OL>\n"}
  359. }
  360.  
  361. proc MkMainMenuFuncListsULType {} {
  362.         menu .menuframe.func.m.lists.ultype
  363.     .menuframe.func.m.lists.ultype add command \
  364.         -label "Default <UL>" \
  365.         -command {DoFormat <UL>\n </UL>\n}
  366.         .menuframe.func.m.lists.ultype add command \
  367.                 -label "Disc" \
  368.                 -command {DoFormat "<UL TYPE=disc>\n" </UL>\n"}
  369.         .menuframe.func.m.lists.ultype add command \
  370.                 -label "Circle" \
  371.                 -command {DoFormat "<UL TYPE=circle>\n" </UL>\n"}
  372.         .menuframe.func.m.lists.ultype add command \
  373.                 -label "Square" \
  374.                 -command {DoFormat "<UL TYPE=square>\n" </UL>\n"}
  375. }
  376.  
  377.  
  378. proc MkMainMenuForms {} {
  379.     menu .menuframe.forms.m
  380.     .menuframe.forms.m add command \
  381.         -label "Form Method Post" \
  382.         -command {DoFormat "<FORM METHOD=\"POST\" ACTION=\"" "\">"} \
  383.         -accelerator "  "
  384.     .menuframe.forms.m add command \
  385.         -label "Form Method Get" \
  386.         -command {DoFormat "<FORM METHOD=\"GET\" ACTION\"" "\">"}
  387.     .menuframe.forms.m add cascade -label "Input Type" -underline 0 \
  388.         -menu .menuframe.forms.m.input
  389.     MkMainMenuFormsInput
  390.  
  391.     .menuframe.forms.m add cascade -label "Select type" -underline 0 \
  392.     -menu .menuframe.forms.m.select
  393.     MkMainMenuFormsSelect
  394.  
  395.     .menuframe.forms.m add separator
  396.     .menuframe.forms.m add command \
  397.         -label "Textarea <TEXTAREA...>" \
  398.         -command {DoFormat "<TEXTAREA NAME=\"" "\" ROWS= COLS=>\n</TEXTAREA>"}
  399.     .menuframe.forms.m add command \
  400.                 -label "Option <OPTION>" \
  401.                 -command {.textframe.vp.text insert insert "<OPTION>"}
  402.     .menuframe.forms.m add command \
  403.         -label "Size SIZE=" \
  404.         -command {.textframe.vp.text insert insert "SIZE="}
  405.         .menuframe.forms.m add command \
  406.                 -label "MaxLength MAXLENGTH=" \
  407.                 -command {.textframe.vp.text insert insert  "MAXLENGTH="}
  408.     .menuframe.forms.m add command \
  409.                 -label "Name NAME=" \
  410.                 -command {.textframe.vp.text insert insert "NAME="} 
  411. }
  412.  
  413. proc MkMainMenuFormsInput {} {
  414.         menu .menuframe.forms.m.input
  415.         .menuframe.forms.m.input add command \
  416.                 -label "Input Name <...NAME=\"\">" \
  417.                 -command {DoFormat "<INPUT NAME=\"" "\">"}
  418.     .menuframe.forms.m.input add command \
  419.         -label "Text <...TYPE=\"text\">" \
  420.         -command {DoFormat "<INPUT TYPE=\"text\" VALUE=\"" "\">"}
  421.     .menuframe.forms.m.input add command \
  422.         -label "Password <...TYPE=\"password\">" \
  423.         -command {DoFormat "<INPUT TYPE=\"password\" VALUE=\"" "\">"}
  424.     .menuframe.forms.m.input add command \
  425.         -label "Checkbox <...TYPE\"checkbox\">" \
  426.         -command {DoFormat "<INPUT TYPE=\"checkbox\" VALUE=\"" "\">"}
  427.     .menuframe.forms.m.input add command \
  428.         -label "Radio <...TYPE\"radio\">" \
  429.         -command {DoFormat "<INPUT TYPE=\"radio\" VALUE=\"" "\">"}
  430.     .menuframe.forms.m.input add command \
  431.         -label "Submit <...TYPE\"submit\">" \
  432.         -command {DoFormat "<INPUT TYPE=\"submit\" VALUE=\"" "\">"}
  433.     .menuframe.forms.m.input add command \
  434.         -label "Reset <...TYPE\"reset\">" \
  435.         -command {DoFormat "<INPUT TYPE=\"reset\" VALUE=\"" "\">"}
  436.         .menuframe.forms.m.input add command \
  437.                 -label "Hidden <...TYPE\"hidden\">" \
  438.                 -command {DoFormat "<INPUT TYPE=\"hidden\" VALUE=\"" "\">"}
  439. }
  440.  
  441. proc MkMainMenuFormsSelect {} {
  442.     menu .menuframe.forms.m.select
  443.     .menuframe.forms.m.select add command \
  444.         -label "Select <SELECT NAME=>" \
  445.         -command {DoFormat "<SELECT NAME=\"" "\">\n</SELECT>"}
  446.     .menuframe.forms.m.select add command \
  447.         -label "Select <SELECT NAME= SIZE=>" \
  448.         -command {DoFormat "<SELECT NAME=\"" "\" SIZE=>\n</SELECT>"}
  449. }
  450.  
  451. proc MkMainMenuAnchors {} {
  452.     menu .menuframe.anchors.m
  453.     .menuframe.anchors.m add command -label "Hyperlink" \
  454.         -command {
  455.             if {[IsSelected] == 1} {
  456.                 set temp [selection get]
  457.                 set temp2 [GetUrl hyperlink]
  458.                 if {[string length $temp2] != 0 } {
  459.                     .textframe.vp.text insert sel.first "<A HREF=\"$temp2\">$temp</A>"
  460.                     .textframe.vp.text delete sel.first sel.last
  461.                 }
  462.             } else {
  463.                 DoFormat "<A HREF=\"" "\">CHANGE_ME</A>"
  464.             }
  465.         } -accelerator "  Alt-H"
  466.     .menuframe.anchors.m add command -label "Inline image" \
  467.         -command {
  468.             if {[IsSelected] == 1} {
  469.                 set temp [selection get]
  470.                 .textframe.vp.text insert sel.first "<IMG SRC=\"$temp\">"
  471.                 .textframe.vp.text delete sel.first sel.last
  472.             } else {
  473.                 DoFormat "<IMG SRC=\"" "\">"
  474.             }        
  475.         } -accelerator "  Alt-I"
  476. }
  477.  
  478. proc MkMainMenuEntities {} {
  479.     global insertspec insertesc entlist entities esclist
  480.     menu .menuframe.entities.m
  481.     .menuframe.entities.m config -disabledforeground black
  482.  
  483.     .menuframe.entities.m add checkbutton \
  484.         -label "insert entities for special (iso) characters (&\344\337..)"\
  485.         -variable insertspec
  486.     .menuframe.entities.m add checkbutton \
  487.         -label "insert entities for escaped chars (\"a\"s'e...)" \
  488.         -variable insertesc
  489.     .menuframe.entities.m add separator
  490.     .menuframe.entities.m add command \
  491.         -state disabled \
  492.         -label "insert entity by selecting from list:"
  493.     .menuframe.entities.m add command \
  494.         -state disabled \
  495.         -font "-adobe-courier-medium-r-normal-*-14-*-*-*-*-*-*-*" \
  496.         -label "name                  iso esc   entity"
  497.     .menuframe.entities.m add separator
  498.     foreach ent $entlist {
  499.         set labeltext \
  500.         [ string range "$entities($ent,text)                   " 0 20 ]
  501.         append labeltext "/ "
  502.         if { $entities($ent,spon) } {
  503.             append labeltext "$entities($ent,iso) / "
  504.         } else {
  505.             append labeltext "  / "
  506.         }
  507.         if { $entities($ent,eson) } {
  508.             append labeltext \
  509.                 [ lindex $esclist $entities($ent,esc1)]
  510.             append labeltext "$entities($ent,esc2) / "
  511.         } else {
  512.             append labeltext "  / "
  513.         }
  514.         append labeltext $entities($ent,ent)
  515.         .menuframe.entities.m add command \
  516.             -label $labeltext \
  517.             -font "-adobe-courier-medium-r-normal-*-14-*-*-*-*-*-*-*" \
  518.             -command \
  519.             ".textframe.vp.text insert insert             \"$entities($ent,ent)\""
  520.     }
  521. }
  522.  
  523. #############################################
  524. # dialog to enter a URL (used by Hyperlink)
  525.  
  526. proc GetUrl {type} {
  527.     global urlchoice
  528.     set urlchoice ""
  529.     set foo ""
  530.     toplevel .geturl
  531.     wm title .geturl "Get $type"
  532.     set x [expr 230 + [winfo x .]]
  533.     set y [expr 100 + [winfo y .]]
  534.     wm geometry .geturl +$x+$y
  535.  
  536.     frame .geturl.top -relief raised -bd 1
  537.     label .geturl.top.lbl -text "
  538. Enter the URL of this $type:"
  539.     entry .geturl.top.entry -textvariable foo
  540.     tixDlgBtns .geturl.btns
  541.     .geturl.btns add ok -text "Ok" -width 8
  542.     .geturl.btns add cancel -text "Cancel" -width 8
  543.     
  544.     pack .geturl.top.lbl -expand yes -fill x -padx 10 -pady 10
  545.     pack .geturl.top.entry -expand yes -fill x -padx 10 -pady 10
  546.     pack .geturl.top -expand yes -fill both
  547.     pack .geturl.btns -fill x
  548.  
  549.     bind .geturl <Enter> {
  550.         focus .geturl.top.entry
  551.     }
  552.  
  553.     bind .geturl.top.entry <Key-Return> { 
  554.         set urlchoice $foo
  555.         destroy .geturl
  556.     }
  557.     
  558.     .geturl.btns button ok config -command {
  559.         set urlchoice $foo
  560.         destroy .geturl
  561.     }
  562.     .geturl.btns button cancel config -command {
  563.         destroy .geturl
  564.         return
  565.     }
  566.  
  567.     tkwait window .geturl
  568.     return $urlchoice
  569. }
  570.  
  571. proc MkMainMenuHelp {} {
  572.     menu .menuframe.help.m
  573.     .menuframe.help.m add command -label "Formatting text" \
  574.         -command {DoHelp HelpFormatting}
  575.     .menuframe.help.m add command -label "Cutting and Pasting" \
  576.         -command {DoHelp HelpCutting}
  577.     .menuframe.help.m add command -label "Inserting Hyperlinks" \
  578.         -command {DoHelp HelpHyper}
  579.     .menuframe.help.m add command -label "Inserting Inline Images" \
  580.         -command {DoHelp HelpInline}
  581.     .menuframe.help.m add command -label "Entities" \
  582.         -command {DoHelp HelpEntities}
  583.     .menuframe.help.m add command -label "Short-cut Keys" \
  584.         -command {DoHelp HelpShort}
  585.     .menuframe.help.m add command -label "HTML Quick Reference" \
  586.         -command {catch {Preview "http://www.ncsa.uiuc.edu/General/Internet/WWW/HTMLQuickRef.html"}}
  587.     .menuframe.help.m add command -label "WYSIWYG Previewing" \
  588.         -command {DoHelp HelpPreview}
  589.     .menuframe.help.m add command -label "Help Browser" \
  590.         -command {DoHelp HelpMain}
  591.     .menuframe.help.m add separator
  592.      .menuframe.help.m add command -label "tkHTML Home Page" \
  593.         -command {catch {Preview "http://alfred1.u.washington.edu:8080/~roland/tkHTML/tkHTML.html"}}
  594. }
  595.  
  596.  
  597.